package com.guowei.jiecloudbackstage.quickbooking.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.guowei.jiecloudbackstage.quickbooking.entity.Order;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ym
 * @since 2021-07-06
 */
public interface OrderMapper extends BaseMapper<Order> {

    /**
     * 查询全部订单信息
     * @return
     */
    @Select("select * from `order`")
    List<Order> getAll();

    /**
     * 新增订单
     * @param order
     * @return
     */
    @Insert("INSERT INTO `hotel`.`order`(`orderId`, `guestName`, `guestPhone`, `roomsbooked`, `roomType`, `roomNumber`, `checkNumbers`, `roomId`, `roomEnvironment`, `arriveDate`, `leaveDate`, `memberCard`, `contractUnit`, `remarks`) VALUES (#{orderId}, #{guestName}, #{guestPhone}, #{roomsbooked}, #{roomType}, #{roomNumber}, #{checkNumbers}, #{roomId}, #{roomEnvironment}, #{arriveDate}, #{leaveDate}, #{memberCard}, #{contractUnit}, #{remarks})")
    int insertOrder(Order order);

    /**
     * 新增房间信息
     * @param order
     * @return
     */
    @Insert("INSERT INTO `hotel`.`roommessage`(`roomId`, `roomType`, `roomState`, `roomEnvironment`, `roomPhone`) VALUES (#{roomId}, #{roomType}, #{roomState}, #{roomEnvironment}, #{roomPhone})")
    int insertRoomMsg(Order order);

    /**
     * 新增客人信息
     * @return
     */
    @Insert("INSERT INTO `hotel`.`guest`(`guestName`, `guestSex`, `guestIDcard`, `guestPhone`, `arriveDate`, `customerStatus`) VALUES (#{guestName}, #{guestSex}, #{guestIDcard}, #{guestPhone}, #{arriveDate}, '未入住')")
    int insertGuest(Order order);

}
